package com.example.nettyclient.testcontroller;

import com.example.nettyclient.netty.NettyClientUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @author : zjs
 * @Date: 2021/4/29 18:28
 * Description:
 */
@RestController
@Slf4j
public class TestController {

    @PostMapping("/helloNetty")
    public String helloNetty(@RequestParam String msg) {
//    public ResponseResult helloNetty(@RequestParam String msg) {
//        ResponseResult responseResult = NettyClientUtil.helloNetty(msg);
        String responseResult = NettyClientUtil.helloNetty(msg);
//        if(!responseResult.getCode().equals("100")){
//            throw new RuntimeException("发生异常，联系管理员");
//        }
        return responseResult;
    }
}
